package com.tyc.threadlocal;

/**
 * 调试查看main里的threadLocals属性是threadLocals.ThreadLocalMap类型
 * ThreadLocalMap中用 table[]数组 来存储entry对象:Entry(ThreadLocal<?> k, Object v)
 * Entry继承自WeakReference，Key为弱引用结构
 * @author tyc
 * @version 1.0
 * @date 2021-08-25 15:46:55
 */
public class ThreadLocalTest1 {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        ThreadLocal t1 = new ThreadLocal();
        ThreadLocal t2 = new ThreadLocal();
        t1.set(1);
        t2.set(3);
        t1.set(2);
        t2.set(4);
        t1.get();
        t2.get();
    }
}
